<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header"><?= $navName ?></div>
        <div class="layui-card-body">
            <form id="addFrm" class="layui-form" action="" lay-filter="component-form-group">
                <input type="hidden" name="id" value="<?= !empty($editData['id']) ? $editData['id'] : 0; ?>">
                <div class="layui-form-item">
                    <label class="layui-form-label">角色名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" value="<?= !empty($editData['name']) ? $editData['name'] : ""; ?>" autocomplete="off" placeholder="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">角色类型</label>
                    <div class="layui-input-inline">
                        <select name="type_id">
                            <option value="">请选择</option>
                            <?php foreach ($type as $k => $v) { ?>
                                <option value="<?= $k ?>"<?= !empty($editData["type_id"]) && $editData["type_id"] == $k ? " selected" : "" ?>><?= $v["name"] ?></option>
                            <?php } ?>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">菜单权限</label>
                    <div class="layui-input-block">
                        <div id="menu_id" class="demo-tree-more" style="width:250px;max-height:300px;padding-bottom: 10px; overflow: scroll;"></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">操作权限</label>
                    <div class="layui-input-block">
                        <div id="power_id" class="demo-tree-more" style="width:250px;max-height:300px; padding-bottom: 10px;overflow: scroll;"></div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea name="remark" placeholder="" class="layui-textarea" style="width:500px"><?= !empty($editData['remark']) ? $editData['remark'] : "" ?></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn customize" lay-filter="formDemo" id="submitBtn">确定提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    var doAddUrl = "<?= $doAddUrl ?>";
    var listUrl = "<?= $this->projectUrl["list"] ?>";
</script>
<script>
    layui.use(['tree', 'util'], function () {
        var tree = layui.tree
                , layer = layui.layer
                , util = layui.util

        var menu_data = <?= $menu_data ?>;
        tree.render({
            elem: '#menu_id'
            , data: menu_data
            , showCheckbox: true  //是否显示复选框
            , id: 'menu_id'
        });
        var power_data = <?= $power_data ?>;
        tree.render({
            elem: '#power_id'
            , data: power_data
            , showCheckbox: true  //是否显示复选框
            , id: 'power_id'
        });
    });
</script>
<script src="<?= PUBLIC_URL . "/admin/js/adminRole/add.js?" . rand() ?>"></script>